System and method for executing multiple concurrent index-driven table access operations

ABSTRACT

An index scan processor and method to perform concurrent scans of stored indexed data. An indexed data scanner performs a first scan of stored data by sequentially scanning through an index data structure and maintains, over a duration of the first scan, a first scan current scan location within the index data structure that indicates a currently accessed record within the stored data structure for the first scan. A scan manager accepts a request for a second scan of the stored data, determines, during the performing the first scan, a starting index scan location within the index data structure for the second scan that is sufficiently near the first scan current index scan location to cause records indicated by the starting location index to be stored within a buffer due to the performing the first scan, and starts the second scan at the starting location and proceeding to the second end key.

CROSS-REFERENCE TO RELATED APPLICATIONS

This application is related to U.S. patent application Ser. No.11/859,384, entitled “SYSTEM AND METHOD FOR ESTIMATING DISTANCES BETWEENMULTIPLE INDEX-DRIVEN SCAN OPERATIONS,” filed on even date herewith theentire disclosure of which is herein incorporated by reference.

FIELD OF THE INVENTION

The present invention relates generally to systems and methods foraccessing database tables and more particularly to scanning index-driventable access operations.

BACKGROUND OF THE INVENTION

Stored data, such as data stored and maintained by a Relational DatabaseManagement System (DBMS) are able to have increased flexibility inaccessing stored data by maintaining indices into the stored data. Anindex into a stored dataset often does not allow accessing dataaccording to the order in which the data is stored in the dataset.Performing multiple scanning operations through an index of a datasettherefore requires non-sequential access to the dataset. Determinationof future data accesses in an index scan is difficult since the indexstructure may not be transparent to application programs and datacaching determinations and makes effective reuse of cached data forindexed data scanning.

Some database processing applications include database architecturesthat try to maximize reuse of partial query results from the query downto the page access level. These architectures achieve this by detectingoverlaps in active query plan operators at query execution time and thenexploit it by pipelining one operator's results to all dependentoperators where possible. Two operators that are able to incorporatethis architecture are table scan and index scan operators. For theseoperators, one scan thread executes that keeps scanning all pages whiletable scan operators can attach to and detach from this thread in orderto share the scanned pages. While this approach works well for scanswith similar speeds, in practice scan speeds can vary by large marginsand even single scans' speeds are usually far from constant due tochanges in predicate evaluation overhead. Therefore, the benefit can belower as scans may start drifting apart. Techniques to prevent drift byautomatically throttling faster scans and by scan-group basedprioritization of buffer pages are generally applicable for table scansonly. In addition to cache or page buffer algorithm improvements, othermethods to reduce disk access costs for multiple concurrent queries withoverlapping data accesses have been investigated. These methods includemulti-query optimization (which requires all queries to be known inadvance) and query result caching. Due to being at a high level of thequery execution hierarchy, the latter may miss out on sharing potentialfor queries that have very different predicates but still end upperforming scans on the same table, for example. Smarter buffer managersmay be used to optimize page replacement under multiple running queriesin order to maximize buffer locality. Such approaches requiresignificant modifications of the caching system.

Therefore a need exists to overcome the problems with the prior art asdiscussed above.

SUMMARY OF THE INVENTION

In accordance with one aspect of the present invention, a method forperforming concurrent scans of stored data based upon an index datastructure for the stored data includes performing a first scan of storeddata where the first scan sequentially scans through an index datastructure indexing the stored data and accessing the stored data in asequence defined by the index structure and where each entry of theindex structure indicating a respective record in the stored data. Themethod further includes maintaining, over a duration of the first scan,a first scan current scan location within the index data structure, thefirst scan current scan location indicating a currently accessed recordwithin the stored data structure for the first scan. The method alsoincludes accepting a request for a second scan of the stored data thatspecifies a second start key and a second end key within the index datastructure. The method further includes determining, during theperforming the first scan, a starting index scan location within theindex data structure for the second scan, the staring index scanlocation being sufficiently near the first scan current index scanlocation to cause a respective record entry indicated by the startingindex scan location to be stored within a buffer due to the performingthe first scan. The method also includes starting the second scan at thestarting index scan location and proceeding to the second end key. Themethod also includes providing results of the first scan and the secondscan.

In accordance with another aspect of the present invention, an indexscan processor to perform concurrent scans of stored indexed dataincludes an indexed data scanner that performs a first scan of storeddata, the first scan sequentially scanning through an index datastructure indexing the stored data and accessing the stored data in asequence defined by the index structure where each entry of the indexstructure indicates a respective record in the stored data. The indexeddata scanner also maintains, over a duration of the first scan, a firstscan current scan location within the index data structure, the firstscan current scan location indicating a currently accessed record withinthe stored data structure for the first scan. The index scan processoralso includes a scan manager that accepts a request for a second scan ofthe stored data, the second scan specifying a second start key and asecond end key within the index data structure. The scan manager alsodetermines, during the first scan, a starting index scan location withinthe index data structure for the second scan, the staring index scanlocation being sufficiently near the first scan current index scanlocation to cause a respective record entry indicated by the startingindex scan location to be stored within a buffer due to the performingthe first scan. The scan manager also starts the second scan at thestarting index scan location and proceeding to the second end key. Theindex scan processor further has an output adapted to providing resultsof the first scan and the second scan.

BRIEF DESCRIPTION OF THE DRAWINGS

The accompanying figures, where like reference numerals refer toidentical or functionally similar elements throughout the separate viewsand which together with the detailed description below are incorporatedin and form part of the specification, serve to further illustratevarious embodiments and to explain various principles and advantages allin accordance with the present invention.

FIG. 1 illustrates a SISCAN operation processing flow, in accordancewith one embodiment of the present invention.

FIG. 2 illustrates a SISCAN operation data exchange architecture, inaccordance with one embodiment of the present invention.

FIG. 3 illustrates index entry distances 300 as determined by an ISMprocess, in accordance with one embodiment of the present invention.

FIG. 4 is a block diagram of a computer system useful for implementingone embodiment of the present invention.

FIG. 5 illustrates a buffer page sharing estimation, in accordance withone embodiment of the present invention.

FIG. 6 illustrates an alternative index scan starting point processing,in accordance with one embodiment of the present invention.

FIG. 7 illustrates an SISCAN page read number estimation algorithm, inaccordance with one embodiment of the present invention.

FIG. 8 illustrates a starting location determination scenario, inaccordance with one embodiment of the present invention.

FIG. 9 illustrates a SISCAN starting location determination algorithm,in accordance with one embodiment of the present invention.

DETAILED DESCRIPTION

While the specification concludes with claims defining the features ofthe invention that are regarded as novel, it is believed that theinvention will be better understood from a consideration of thefollowing description in conjunction with the drawing figures, in whichlike reference numerals are carried forward.

Index Scan Overview

An access plan consists of a number of operators, used to satisfy agiven query, as determined by the optimizer. The operators representprocessing steps such as table scans, joins, predicate evaluations, etc.One such operator is IXSCAN, or index scan. An IXSCAN includes variousattributes, such as which index to scan, whether there are predicates toapply, etc.

A standard index scan consists of reading leaf pages from an index,processing each entry (i.e., a key and a row identifier, or RID)sequentially, and (possibly) following each RID to retrieve thecorresponding record from the underlying table. There may be a start keyand/or an end key to limit the scope of the scan, depending onpredicates in the SQL query.

An example of a conventional index scan process is able to include aspecification of a start key. The start key, if provided, is used in atree search that starts with the root of the index to find the childpage of each non-leaf page that may contain the key value specified.This tree search is continued until such a child is a leaf page, andthat child leaf page is used as the starting page of the scan. If thereis no start key, the index scan begins at the first leaf page in theindex. Once the starting page has been determined, the scan begins witha loop over the leaf pages and a loop over each entry. The pagecorresponding to the RID of each leaf page is read into a buffer or maybe already loaded into the buffer due to a prior access. The recordspecified by that RID is located and is then handled in whatever way isneeded for the query processing, e.g., predicates, aggregations,sorting, etc.

Pages being processed by the scan operation are retrieved from a datastorage and stored in a temporary buffer, such as a cache memory or adatabase bufferpool. Once the processing of a conventional index scanoperation reads and processes the relevant parts of a table pageassociated with an index entry, that page is released from the buffer sothat the space can be used for other pages, if needed. In releasing thepage, the page is able to be marked with an indicator, such as apriority value, that indicates a relative order in which pages stored inthe buffer should be overwritten. One example of an indicator is apriority assigned to the released page. The priority assigned to thereleased page is an indicator to the caching algorithm to affect theorder in which pages to first discard, i.e., which pages to actuallyoverwrite with new data, when space is needed. In conventional indexscan processes, the priority of released pages is typically fixed duringa scan. One embodiment of the present invention is alternatively able toadjust the priority of released pages according to various criteria, asis discussed below, so that pages that are likely to be reprocessed byother operations are more likely to be retained in the buffer. Once thepage is released from the buffer, the next iteration of the loop findsthe next Record Identifier (RID) in the index entry, if any. If theindex scan specifies an end key, each entry encountered in the loop iscompared against that the end key value to determine if the scan iscomplete. If there is no end key, the scan ends with the last entry inthe last leaf page.

Index Scan Location

At any time during an index scan, it is said to have a particular“location”. The term “location” in this description indicates which key,i.e., entry in the index being used for the index scan, and RecordIdentifier (RID) that is currently being processed by the scanoperation. Whenever the index scan moves “forward,” the next RID of thesame key value is accessed until no more are available. Then, the scanproceeds to process the next key value (in either increasing ordecreasing order) and the first RID for that key.

The operation of an index scan process differs from a table scan processin several significant ways. In contrast to the index scan processdescribed above, where index keys are used to access data in an orderdifferent than the order in which the data is stored in a table, thecurrent scan location of a table scan is described simply as the currentRID. The next location to be used by the table scan is obtained bysimply increasing or decreasing the RID. In the case of an index scan,the next location is described by RIDs in each index entry, and then byproceeding through the index entries to determine the subsequent pagesto process. This is an important distinction because in an index scan,only the key values are in increasing or decreasing, the RIDs may not bein any specific order. Access to the stored data in an index scan canlead to many expensive disk seek operations if the RIDs are poorlydistributed across the scan range of an index scan. One embodiment ofthe present invention provides data caching processing that is able tomitigate this problem.

Concurrent Index Scans

Often, there will be multiple applications performing the same indexscan at the same time. There may or may not be overlap in the ranges ofvalues covered by the concurrent scans. The scans may have the samevalues for start and end keys, or the start and end key ranges mayoverlap in some way, or they may be disjoint.

If there is overlap in the ranges specified for start and end keys, thenthe scans may benefit each other in terms of buffer usage. In the caseof multiple index scans accessing a common range of an index, the firstindex scan to read a particular page pays the price of the physical I/O.If a second index scan over the same range of the index can process thatpage while it is already in the buffer pool, a second physical read isable to be avoided. In a case where the second index scan starts aftersome time has passed, there is a chance that the buffer manager hasalready overwritten that page and the second index scan will have to doa physical read again. In this second case, both scanners will have todo physical reads of the same sequence of pages, resulting in roughlytwice the number of physical reads as would be the case if the secondindex scan could access the data read during the first index scan whilethat data is still in the buffer. In other words, if the scan locationsare processing index keys that are close to one another, the number ofphysical page reads needed is able to be reduced.

Sharing Index Scan Operator (SISCAN)

One embodiment of the present invention introduces a new index scanoperator, identified herein as “SISCAN” (for “sharing index scan”). Thisoperator, as provided by one embodiment of the present invention, isable to be inserted at most places of a query plan where, for example, aconventional IXSCAN operator would be applicable. The new index scanoperation of one embodiment of the present invention enables thecorresponding index scans to actively share buffer contents with otherongoing index scans that are using the same portion of an index.

In a conventional query plan, the IXSCAN operator may be associated witha start and/or end key specifying the range of an index to be scanned.The IXSCAN operator then traverses the corresponding index structure atruntime starting from the start key and ending with the last identifiermatching the end key.

The SISCAN operator of one embodiment of the present invention alsoresults in traversing the index structure and accessing every recordbetween the specified start and end key. The SISCAN operator, however,is able to perform a modified traversal algorithm to improve thelikelihood of sharing data pages already retrieved into a buffer byother SISCAN operations. The SISCAN operator of one embodiment performsthe traversal of an index as follows:

1. pick a start location startLoc (i.e., key and RID)

2. scan index from startLoc to end key

3. scan index from start key to startLoc

By allowing the SISCAN to start at any location in step 1 above, oneembodiment of the present invention allows buffer page sharing to beimproved by starting a subsequent index scan that is associated withanother SISCAN operation at or near the current location of an ongoingSISCAN operation. If these two index scan operations have a similarspeed, they will subsequently read the same index entries and therebythe same base table pages, even if the index structure of the storeddata lists RIDs that are “randomly” distributed across the scan range.

One embodiment of the present invention includes a SISCAN operator thathas additional parameters for controlling various aspects of buffersharing. Examples of some of these parameters are a scan speed estimateand a scan amount estimate. The scan speed estimate characterizes theindex scan's speed in, for example, a number of pages read per second.The scan amount estimate characterizes the overall number of pages to beread between start key and end key. These parameters are supplied in oneembodiment by a costing component of the query compiler and can be basedon table statistics and/or past measurements.

Implementation of one embodiment of the present invention uses piecewisescans of the specified range of an index. The implementation ofpiecewise scans is not difficult in many implementations because mostRDBMSs, for example, already provide similar facilities for farming outscans to multiple processors. Also, the breaking of an index scan by oneembodiment of the present invention into only two phases rather thansome other more complex scan pattern reduces both implementationcomplexity and the required memory footprint for scan statusinformation.

SISCAN Operators in Query Plans

In one example of a query plan optimizer's processing of a particularquery plan, the query optimizer may choose an index scan operation oversome other access type if the cost caused by the index scan is lowerthan the cost caused by the other access types. This may be due to, forexample, selectivity or due to sorted results needed later in the queryplan, making an index scan desirable.

An Example of SISCAN Process Logic

In one embodiment of the present invention, a SISCAN is able to beimplemented as multiple IXSCANs. As a simplified example, one SISCANoperation is conceptually similar to performing two regular IXSCANs.Examples of differences between an IXSCAN and a SISCAN is that (1) aSISCAN can start in the middle of its key range, and (2) the SISCANperiodically calls a new component, the index scan sharing manager(ISM). The ISM of one embodiment is a component of a shared buffermemory controller and is discussed in depth below. For the purposes ofthe current description, it suffices to understand that the ISM keepstrack of ongoing SISCAN operations and influences index scan speeds andbuffer replacement decisions based on information concerning currentSISCAN operations.

SISCAN operations of one embodiment interact with the ISM in severalways. For example, each SISCAN operation of one embodiment of thepresent invention first registers with the ISM and provides its startkey, its end key, and an expected time needed to finish the scan. TheISM, based on information obtained from other concurrently executingSISCAN operations, then determines whether the new SISCAN should startat the first key/RID of its scan range or whether it can join some otherongoing SISCAN. We will discuss the determination of an optimal startingindex for newly commenced index scan operations, as is implemented byone embodiment, in detail below.

The operations performed for each index entry by the SISCAN index scanare similar to the processing of index entries by an IXSCAN except thatSISCAN operations on one embodiment periodically call the ISM process toprovide an update of their scan location within the index. In variousembodiments of the present invention, a call by the SISCAN operation tothe ISM process to provide an update of the scan location for thatSISCAN operation is able to be performed, for example, at every page ofthe stored data that is processed, the update is able to be performed atsome period, for example a time period or a number of pages read period,or the update is able to be performed in any periodic or aperiodicmanner. One embodiment of the present invention allows more accuratelocation information to be available in the ISM at a cost of additionalprocessing overhead.

A page of stored data that has been accessed according to a currentlyprocessed index is then released from the buffer. Contrary to theprocessing of an IXSCAN process, one embodiment of the present inventionimplements a SISCAN operation with an ISM process that also dynamicallyadjusts the priority of the page of stored data that was released fromthe buffer. The ISM processing of one embodiment sets a priority of thepage that is released from the buffer based on the state of allcurrently executing SISCAN operations. The ISM process of one embodimentis able to adjust two parameters in conjunction with a SISCAN operation,picking the starting location of the scan and setting the priority ofpages that are released from the buffer. One embodiment of the presentinvention includes an ISM process that chooses the priority of pagesreleased from the buffer such that pages that will be soon needed byother SISCAN operations receive a higher priority than pages that arenot expected to be needed by other SISCAN operations. A process by whichthe ISM of one embodiment chooses a priority to assign to released pagesis described below.

A first phase of a SISCAN operation involves scanning the index from the“startLoc” index, as described above, to the end of the index rangespecified for the SISCAN. After completing that first phase, a secondindex scan is performed starting at the original start key of the SISCANcommand and ending at the “startLoc” key. After this second index scancompletes, the SISCAN of one embodiment informs the ISM that the indexscan has ended. When reaching this point, all index entries starting atthe start key and ending at the end key have been read and processed.Conceptually, one can think of the SISCAN logic of one embodiment of thepresent invention as two back-to-back IXSCANs over adjacent key ranges.

FIG. 1 illustrates a SISCAN operation processing flow 100, in accordancewith one embodiment of the present invention. The SISCAN operation ofone embodiment of the present invention starts scanning a specifiedindex in a manner similar to an IXSCAN but instead of starting from thestart key, it starts from the location “startLoc” that is assigned to itby the ISM (200). The SISCAN operation of one embodiment begins bydetermining, at step 102, the starting location of a first phase of theindex scan. In one embodiment, the ISM provides an interface through a“startSISCAN” function that accepts the scan parameters and returns thestarting location to be used by that particular SISCAN operation. Theprocessing further sets the current index entry to be processed,represented as “I,” equal to the startLoc value returned by the startSISCAN function of the ISM process.

The processing proceeds to determine, at step 104, if the current indexentry is greater than the end key specified for the current scanoperation, which is returned by the function ix(end key). Since the scanhas just started, this is not likely to be the case so the processingproceeds to performing, at step 106, the specified operations on thedata page indicated by the current index entry “I.” The processing ofone embodiment of the present invention continues by providing anupdate, at step 108, of its current processing location to the ISMprocess. Further embodiments of the present invention are able toprovide this update at some fraction of iterations of this processingloop.

The processing continues by releasing, at step 110, the currentlyprocessed data page, the data page that is indicated by the currentlyprocessed index entry. One embodiment of the present invention sets thepriority of the released data page according to an estimation oflikelihood that another SISCAN operation will be accessing that datapage. The processing then increments, at step 112, the index entry tocurrently process to the next index entry. The processing then returnsto determining, at step 104, if the current index entry to process isgreater than the index entry at the end of the specified scan range.

If the current index entry to process is determined, at step 104, to begreater than the end key for the specified scan range, the first phaseof the scan has reached the end of the scan range. As described above,it is likely that the first phase of the SISCAN operation started in themiddle of the index range that is required to be scanned. The processingthen returns to perform the second phase of the SISCAN operation byscanning over the first part of the specified index scan range. Theprocessing proceeds to implement this second phase of the SISCANoperation by setting, at step 114, the current index entry to the indexentry specified as the start of the SISCAN operation. The processingthen continues to determine, at step 116, if the current index locationis at or beyond the specified startLoc determined for the SISCANoperation. If the current index is at or beyond the startLoc, the secondphase of the SISCAN is complete and the ISM is notified by a call, atstep 126, to the endSISCAN function of the ISM process.

If the current index is not at or beyond the startLoc, the processingcontinues by performing, at step 118, operations on the data pagespecified by the current index entry. The processing continues byupdating, at step 120, the current location of the SISCAN operation withthe ISM by the update SISCAN function of the ISM process. The processingreleases, at step 122, the data page from the buffer, with aspecification of a priority that indicates the order in which the datapage is to be overwritten in the buffer. The current index entry is thenincremented and the processing returns to determining, at step 116, ifthe current index is at or beyond the startLoc. The processing thencontinues as described above.

Index Scan Sharing Manager (ISM)

The index scan sharing manager (ISM) process of one embodiment of thepresent invention maintains information of ongoing index scans. Anexample of information maintained by an ISM process of one embodiment ofthe present invention includes the location within the index range ofeach SISCAN operation, and the respective speed of each SISCANoperation. The ISM process of one embodiment is able to maintain thisinformation with very little overhead in terms of memory and CPU usage.The ISM process of one embodiment also determines start locations of anew SISCAN operations and is able to perform scan speed regulation andbuffer entry reprioritization based on the characteristics of ongoingSISCAN operations with the goal of maximizing buffer reuse by multipleSISCAN operations.

Architectural Context of an ISM Process

FIG. 2 illustrates a SISCAN operation data exchange architecture 200, inaccordance with one embodiment of the present invention. During theexecution of a query with index scans, new SISCAN operations of oneembodiment are received at a data access subsystem 202 from a querycoordinator or a user 206. These new SISCAN operations are then spawnedas individual processes, such as SISCAN operation process 1 250 andSISCAN operation process 2 252. Two SISCAN processes are illustratedherein to illustrate the functions of one embodiment of the presentinvention and to simplify this description. Any practical number ofSISCAN operations is able to be supported by one embodiment of thepresent invention.

Each spawned SISCAN operation of one embodiment is in communicationswith the ISM process 208 through a SISCAN-ISM interface, such asSISCAN-ISM interface 1 220 and SISCAN-ISM interface 2 224. TheSISCAN-ISM interface is able to provide, for example, an indication of astart or end of a SISCAN operation 230 to the ISM process 208. Theindividual SISCAN operations then determine which table pages to scanvia index access based upon data read from index 1212 through data indexinterface 220. The required pages are then fetched from the buffer 252by appropriate data read commands such as the “get page x” commands 234and 238. If the requested page is not already in buffer 252, the data isretrieved from disk 204 by reading table T 210.

The executing SISCAN operations 250 and 252, periodically provideinformation to the ISM process 208 indicating the current index locationbeing processed by that SISCAN operation 250 and 252, such as by an“update location” function call over the SISCAN-ISM interfaces 230 and232. The SISCAN operation finally informs the ISM process when thatSISCAN operation is complete, such as by a endSISCAN function call overthe SISCAN-ISM interface 230 and 232.

The above operational architecture of one embodiment of the presentinvention allows interfaces for the ISM process to be kept relativelysimple. In one embodiment, the ISM process is only required to haveinterfaces for accepting a “start/end of SISCAN” and an “updatelocation” from the SISCAN operations. The above operational architecturealso allows the ISM to be kept separate from the rest of thearchitecture. In one embodiment, there is no direct interaction betweenthe ISM process and buffer replacement algorithms or index accessfunctions. Only the SISCAN processes of one embodiment interact with theISM process, allowing the implementation of changes to the architectureto be made by changes only localized processing components.

Attributes Maintained by ISM

ISM Processes maintain information that is used to determine how toestablish a partial ordering between concurrently executing SISCANoperations. This partial ordering of SISCAN operations supports, forexample, determinations of where to start new SISCAN operations withinthe index and how to control the speed of the concurrently executingSISCAN operations.

One embodiment of the present invention maintains one ISM process perdata storage buffer since index scans usually do not span multiple datastorage buffers. Each ISM process maintains statistics about the ongoingSISCAN operations. For each SISCAN operation, the ISM process maintainsthe location of each SISCAN operation (e.g., by maintaining a record ofthe currently processed key value and RID), the remaining pages in thescan range for each SISCAN operation. As described above, the remainingpages in a scan range for each SISCAN operation is initialized from ascan amount estimate provided by the SISCAN operator, an average scanspeed (specified in, for example, pages/second). In one embodiment, theaverage scan speed is initialized as “(estimated pages in scanrange)/(estimated scan time)” and updated during scan execution. The ISMprocess further stores the start and end key of the scan range of eachoperating SISCAN, an anchor location and an anchor offset for eachoperating SISCAN. The ISM process of one embodiment updates theseattributes whenever a SISCAN operation starts, finishes, or updates itslocation.

Partial SISCAN Location Order

In contrast to direct table scans, it is generally difficult todetermine distances between index scans by only inspecting their scanlocations because the RIDs of index scans are not necessarily accessedin any monotonic order. The distance between index scans is thereforenot simply a difference between the scan locations of two SISCANoperations. However, increasing buffer sharing and making adjustments tothe index scan speed to increase buffer sharing is facilitated byestimating the distance between two index scans within an index. Inorder to determine the distance within the index between concurrentlyexecuting SISCAN operations using the same index, the ISM of oneembodiment performs processing to determine and maintain informationdescribing the distance of a SISCAN operation within the index to a,known location within the index that is able to be common with themultiple concurrently executing SISCAN operations. In one embodiment ofthe present invention, this location is referred to as the “anchorlocation.”

Whenever a new SISCAN operation, referred to herein as “SISCAN A,” ofone embodiment of the present invention starts, it is able to start at alocation in the index that is not related to other SISCAN operations orit is able to start at a location within the index that is a locationthat is currently being processed by a second SISCAN operation, which isreferred to herein as “SISCAN B.” When SISCAN A starts at a locationthat is unrelated to other SISCAN operations, the ISM process of oneembodiment sets the current anchor for SISCAN A to the starting locationfor SISCAN A. The anchor distance is then set to 0. When SISCAN A isstarted at a location that is currently being processed by the secondSISCAN operation, i.e., SISCAN B, the ISM process of one embodiment ofthe present invention sets SISCAN A's anchor to the location of SISCANB's anchor and SISCAN A's anchor offset equal to the value of SISCAN B'soffset. Whenever SISCAN A or SISCAN B move, their anchor offset isupdated with the moving distance, but the anchor value, which points toa an index entry that was processed by both SISCAN operations, remainsthe same. Based upon the distance of SISCAN A and the distance of SISCANB from the anchor, which are respectively stored in the SISCAN A offsetand the SISCAN B offset, the ISM process is able to calculate thedistance between the currently processed index entries of SISCAN A andSISCAN B.

It should be noted that the maintenance of anchor locations and offsetsas described above for one embodiment of the present invention isperformed while regarding the index as a black box with no access tointernal data of or dependency upon the implementation of the indexfunction of the data storage system. No changes are necessary in the waythe index is managed and in fact, the same anchor/offset technique worksfor any type of index that has a deterministic ordering.

FIG. 3 illustrates index entry distances 300 as determined by an ISMprocess, in accordance with one embodiment of the present invention. Asillustrated by the index entry distances, it is useful to think of theanchors and anchor offset values as a basis for defining a partialordering between the index entries being processed by different SISCANoperations. The illustrated index entry distances 300 shows two anchors,a first anchor 302 and a second anchor 320, and six concurrentlyexecuting SISCAN operations, a first SISCAN operation 304, a secondSISCAN operation 306, a third SISCAN operation 308, a fourth SISCANoperation 310, a fifth SISCAN operation 322 and a sixth SISCAN operation324. Four of the illustrated SISCAN operations, the first SISCANoperation 304, the second SISCAN operation 306, the third SISCANoperation 308 and the fourth SISCAN operation 310 are shown to have thefirst anchor 302 in common with each other by having the distancesbetween those current scan locations and the first anchor 302 defined.The other two SISCAN operations, the fifth SISCAN operation 322 and thesixth SISCAN operation 324 are shown to have the other anchor, thesecond anchor 320, in common by having the distances between the currentlocation of those scans and the second anchor 320 defined.

SISCAN operations that have anchors in common are referred to herein asanchor groups. In one embodiment of the present invention, the relativelocations between the currently processed index entries of index scanswithin anchor groups are able to be determined by comparing their anchoroffsets. The relative locations between currently processed indexentries of index scans that are in the same anchor group, however, arenot able to be determined. Since the relative locations of index scansof SISCAN operations that are not in the same anchor group is not ableto be determined, we obtain a partial ordering between SISCAN operationsas AØB, BØC, CØD, EØF where “Ø” denotes the (transitive) partial orderdefined by anchors and offsets.

SISCAN Initial Placement

One embodiment of the present invention utilizes SISCAN operations thatstart by calling a startSISCAN function of the ISM process. The ISMprocess, in response to the invocation of the startSISCAN function thendetermines where the new SISCAN should start by inspecting its scanstatistics data structure. If there are no other concurrently executingSISCAN operations, the ISM process is able start the new SISCANoperation at the start key/RID specified by that SISCAN operation. Ifthere are some other ongoing SISCAN operations, the ISM process thendetermines a starting location for the scan associated with the newSISCAN based on the speeds, locations, and scan ranges of otherconcurrently executing SISCAN operations. One embodiment of the presentinvention operates to maximize buffer sharing between all SISCANoperations by selecting the starting location of each scan associatedwith each SISCAN based on the available statistics.

If, for example, there is one ongoing scan A with scan range [key “a”,key “f”] and its current location is at key “b” and the scan range of anew scan B is [key “d”, key “g”], B cannot share buffer pages bystarting at A's location because key “b” is outside of B's scan range.

Even when ruling out cases where the current location of ongoing scansis outside of the scan range of the new scan, there may be many othercurrently executing SISCAN operations that can be selected as thestarting location for a new SISCAN operation. The starting location of anew SISCAN operation depends on (1) the speeds, and (2) the remainingscan ranges of the currently executing SISCAN operations. We also notethat in order to find the optimal starting location for a new SISCANoperation, it is not enough to consider ongoing SISCAN operationsindividually. In many cases, a new scan may first share buffer pageswith one ongoing scan and then switch to share buffer pages with anotherscan due to speed changes of and drift between the different currentlyexecuting SISCAN operations. An algorithm to find the optimal placementof one embodiment therefore also considers starting locations that donot lead to immediate sharing if such a starting location is able tolead to more buffer page sharing between currently executing SISCANoperations later on.

Estimating Sharing Potential

Each starting location of a new SISCAN has a different sharing potentialof buffer memory pages with other currently executing SISCAN operationsbased on those other currently executing SISCAN operations.

FIG. 5 illustrates a buffer page sharing estimation 550, in accordancewith one embodiment of the present invention. The buffer page sharingestimation 550 includes an x-axis that represents the location of theindex scans within the index and the y-axis represents time increasingtowards the bottom of the figure. Current time is illustrated as thetop-most dashed line T0 500. There are three ongoing SISCAN operationsillustrated for the buffer page sharing estimation 550, SISCAN A 502,SISCAN B 504, and SISCAN C 506 that each have different scan ranges andspeeds. The buffer page sharing estimation 550 further includes a futureSISCAN operation, SISCAN D 508. The future SISCAN operation, SISCAN D508, is able to be, for example, an implementation of a second phase ofSISCAN A 502 (assuming SISCAN A 502 was started in the middle of itsspecified index scan range and completing the SISCAN A 502 includesperforming a second phase as discussed above), or SISCAN D 508 is ableto be a scan that is the inner of a nested loop join and thereforerepeated multiple times.

In an example of a start of a new SISCAN operation, which is indicatedas SISCAN E 510, when the processing system is in the above describedstate. The scan range and expected scan time of the new SISCAN E 510 isshown as a dotted box 512 in the center. The width of the dotted box 512corresponds to the range of SISCAN E 510 and the height of the dottedbox 512 corresponds to the time estimated to perform SISCAN E 510.

As an example of determining an optimal starting location for SISCAN E510, several candidate starting locations are considered. A firstcandidate starting location is at the beginning of the specified scanrange for SISCAN E 510. The index scan performed as a result of thisfirst candidate starting location corresponds to a trace as shown by thedotted line marked as Trace “E” 514. Between the current time T0 andtime T1, there are four ongoing SISCAN operations (SISCAN A 502, SISCANB 504, SISCAN C 506, and SISCAN E 510). Only SISCAN C 506 and SISCAN E510 are close enough to share some buffer pages (as shown by the firsthashed area 515 between “C” and “E”). However, sharing is only possibleif SISCAN C 506 and SISCAN E 510 are close to each other since otherwisethe operation of SISCAN A 502 and SISCAN B 504 could cause buffer pagesto be displaced. Between time T1 and T2, only three scans (SISCAN C 506,SISCAN D 508, SISCAN E 510) are currently running, thereby allowing forsharing even when SISCAN C 506 and SISCAN E 510 are further apart (shownby the larger second hashed area 516 between T1 and T2). However, atsome point, the distance between SISCAN C 506 and SISCAN E 510 will betoo large due drift caused by their different speeds, and sharing willend.

The potential for concurrent SISCAN operations to share buffered data inthe above scenario can now be calculated by counting how often storeddata pages for SISCAN E 510 range are read and re-read. In the key rangebefore SISCAN C 506 and SISCAN E 510 start sharing data indicated bycommon index entries, there are three scans that read those pages atdifferent times, SISCAN C 506, SISCAN D 508, and SISCAN E 510, which canresult in each page in this range being read three times. The second keyrange is when only SISCAN C 506 and SISCAN E 510 are active and sharing,so each page here is read only once. In the next range, SISCAN A 502 isactive in addition, so each page is read twice. Then SISCAN C 506 andSISCAN E 510 stop sharing, so each page is now read three times. In thelast key range, SISCAN B 504, SISCAN C 506, and SISCAN E 510 are activebut none is sharing, so each page is read three times. If for example,the sizes of the ranges are 15, 30, 15, 20, and 10 pages respectively,then the overall amount of page reads in the dotted box 512 would be15*3+30*1+15*2+20*3+10*3=195. This compares to the worst case withoutsharing which is 15*3+30*2+30*3+5*3+10*3=240. So, the potentialreduction in data reading I/O through the sharing allows by oneembodiment of the present invention is 19%.

FIG. 6 illustrates an alternative index scan starting point processing650, in accordance with one embodiment of the present invention. In thecase of the alternative index scan starting point processing 650, SISCANE 610 is started at an index entry that is near the index entrycurrently being processed by SISCAN A 602. SISCAN E 610 then scans untilit reaches the right end of the scan range, and then the processing“wraps around” and starts a second scan phase 614 from the left end ofthe index scan range for SISCAN E 610. The alternative index scanstarting point processing 600 shows two dotted lines corresponding toSISCAN E, a first scan phase 618 and a second scan phase 614. In thisscenario, SISCAN E 610 is able to share data retrieved into the datastorage buffer by SISCAN A 602 from the beginning of its processinguntil SISCAN A ends, i.e., within a first shaded area 616, due to anassumption that both of these SISCAN operations have similar speeds andtherefore stay close together in index entries to be processed. AfterSISCAN E 610 shares data that had been retrieved by SISCAN A 602, SISCANE 610 then shares pages with SISCAN C 606 until the end of the scanrange for SISCAN E 610, i.e., within the second shaded area 620, isreached. Finally, after starting in the second scan phase 614, SISCAN E610 is able to share data retrieved into the data storage buffer bySISCAN D 608 until SISCAN D ends, as is reflected by a third shaded area622.

A data sharing potential is able to be calculated for the alternativeindex scan starting point processing 600 in a manner similar to that asused above. In the first key range, in which SISCAN D 608 and SISCAN E610 are sharing data in a data buffer and SISCAN C 606 is not, each pageis read twice. In the second range where SISCAN C 606 and SISCAN D 608are ongoing but not sharing data in a buffer, each page is read twice.In the third range, where SISCAN A 602 and SISCAN E 610 are sharing datain a buffer but SISCAN C 606 is not, each page is again read twice. Inthe last range, where SISCAN C 606 and SISCAN E 610 are sharing data ina buffer but SISCAN B 604 is not, each page is also read twice. In anexample where these respective ranges have index entry sizes of 15, 20,40, and 15, we have 15*2+20*2+40*2+15*2=180 page reads. The potentialI/O reduction is therefore 25%. In the case of the above two example,starting SISCAN E 610 near SISCAN A 602 is therefore the preferredchoice.

FIG. 7 illustrates an SISCAN page read number estimation algorithm 750,in accordance with one embodiment of the present invention. The SISCANpage read number estimation algorithm 750 estimates a number of pagesthat are required to be read into a memory buffer, assuming improvedreuse of data pages that are already resident in the buffer, given astart location and a given set of concurrent SISCAN operations. TheSISCAN page read number estimation algorithm 750 first segments theoverall key range into adjacent key ranges that share the sameconcurrent scans, at steps 702, 704, and 706. The processing continuesby determining, for each such key range, the number of I/O reads thatare to be performed, at steps 708, 710, 712, and 714. The function“reads(r)” illustrated for the SISCAN page read number estimationalgorithm 750 in step 714 determines the number of reads and re-readsfor any page in the range r and the function pages(r) determines thenumber of pages in range r. The end result of this calculation is theoverall number of reads for the specified placement of the differentconcurrent SISCAN operations. Since the number of time intervals isproportional to the number of ongoing SISCAN operations and the numberof key ranges in R is proportional to the number of SISCAN operations aswell, the running time of this function is on the order of S, which isrepresented as O(|S|), where “S” represents the set of scan operations.

Finding the Best Starting Location

One manner in which to determine an optimal starting location is to tryevery possible starting location within the specified scan ranges forall concurrently executing SISCAN operations and selecting the staringlocations with maximum sharing potential calculated using the previouslydescribed algorithm. Since the complexity of such an approach requiresO(p|S|) steps where p is the number of pages in the scan range, thistechnique may require a significant amount of computing resources. Analternative manner in which to determine an optimal starting location,as is utilized by one embodiment of the present invention, utilizes onepossible heuristic to provide this determination with lowercomputational costs and is based on the partial scan ordering definedabove, which treats the index structure as a black box and relies on nospecified structure of or access to the index structure of theunderlying data management system.

FIG. 8 illustrates a starting location determination scenario 850, inaccordance with one embodiment of the present invention. The startinglocation determination scenario 850 illustrates an illustrative examplewith one anchor group of three SISCAN operations, indicated as SISCAN A802, SISCAN B 804, and SISCAN C 806. The current time is again indicatedas T0 852. In the starting location determination scenario 850, thecurrent location of SISCAN A 802 current scan location, SISCAN B 804current scan location, and the SISCAN C 806 current scan location areillustrated as the intersection of those traces with the dashed T0 line852. These three current scan locations are illustrated as inside thenew SISCAN operation's specified key range 808, which is shown as ashaded region. The SISCAN A end key 810 and the SISCAN B end key 812 andthe anchor 814 are also within the new SISCAN operation's specified keyrange 808. SISCAN C's end key 816 is shown as outside of the new scan'srange. Contrary to the previous algorithm, the ISM processing of oneembodiment only has partial knowledge about the relative locations ofthe currently operating SISCAN operations and their end keys. Thedistance of SISCAN A's current location from the anchor 818, which is 30in this example, the distance of SISCAN B's location from the anchor820, which is 60 in this example, and the distance of SISCAN C'slocation from the anchor 822, which is 75 in this example, are availableto the ISM process of one embodiment of the present invention. Inaddition, The ISM process of one embodiment of the present invention isable to determine the past (and assumed future) speed and the expectednumber of remaining pages of SISCAN A 824, SISCAN B 826, and SISCAN C828, which are denoted in the figure as “remaining(A/B/C)”. Scan speedand remaining scan pages are maintained for each SISCAN, as is describedabove, and provide the approximate end location of a scan relative toits start location.

As described above, the ISM process has nearly all of the parametersneeded to apply the above described algorithm of FIG. 6 to this example.The ISM process maintains the current scan locations and the endlocations of SISCAN A 802, SISCAN B 804, SISCAN C 806, along with theirtrace slopes. The ISM process further is able to determine an estimateof the new SISCAN operation's expected speed (from the average speedattribute) and the new SISCAN operation's end key location is fixed. Theonly parameter that is to be determined by one embodiment of the presentinvention is the new SISCAN operation's start location. There are threeindex entries that are clear candidates to pick from: the currentlocation of SISCAN A, SISCAN B, and SISCAN C. One heuristic that isavailable is to calculate the sharing potential for data alreadyretrieved into a buffer for each of these SISCAN operations. The SISCANoperation that is associated with the best calculated sharing potentialis able to be used as an optimum starting location for this group ofscans. The same procedure is then repeated for other anchor groups thatoverlap the new scan's key range. The ISM of one embodiment picks thestarting location for the new SISCAN operation that has the best overallsharing potential among all groups.

FIG. 9 illustrates a SISCAN starting location determination algorithm950, in accordance with one embodiment of the present invention. TheSISCAN starting location determination algorithm 950 initializes, atsteps 900 and 902, and then iterates over each anchor group, at steps904 through 914. For each group, the new SISCAN operation's optimalstarting location in this group and the estimated cost due to buffersharing is determined, at step 910. If the cost is better than thepreviously best cost found, as is determined at step 912, the best costand start location are updated, at step 914. Once all groups have beeninspected, the best start location is determined, at step 906. Thisalgorithm evaluates the required I/O reads once per scan and thereforehas an overall cost of O(|S|2).

Once a starting index entry location is determined for the new SISCANoperation, the anchor for the new SISCAN operation is set to either thestart key/RID of the new SISCAN operation, if the new SISCAN operationcannot start within the index range of a currently executing SISCANoperation, or the anchor for the new SISCAN operation is set to ananchor of another currently executing SISCAN operation, if the newSISCAN operation starts at another SISCAN operation's location. Theanchor offset for the new SISCAN operation is therefore set to eitherzero or to the anchor offset of the other SISCAN operation offset,respectively.

SISCAN Operation Attribute Updates

As discussed above, the ISM process of one embodiment has a softwareinterface that is called periodically by the various SISCAN operationsto provide updated SISCAN operation scan location in its datastructures. This call is able to be performed every time a new tablepage is accessed or at some other periodic or non-periodic number ofpage accesses. There is a tradeoff: if the updates are too frequent, theISM process maintains a more accurate accuracy of the SISCAN operation'sscan location in the data structure but at the cost of extra processingoverhead. On the other hand, if the updates are too infrequent, thisoverhead is lower but the location accuracy maintained by the ISMprocess decreases, leading to less optimal decisions for SISCANoperations start locations and speed control.

At every location update call to the ISM process of one embodiment ofthe present invention, the following SISCAN fields are modified: currentscan location, remaining pages in the scan, scan speed, andanchor/offset information. In one embodiment, the scan speed iscalculated as (pages read since last update)/(time since last update).Since this speed estimate depends only on the near past, it is able tocapture speed fluctuations caused by interactions with other ongoingscans.

The anchor offset update is either simply incremented or is recalculatedto accommodate a shift in the anchor's location as described above. Forexample, in a scenario where a first SISCAN operation has a new scanlocation that is equal to the anchor location entry location of a secondSISCAN operation, the processing of one embodiment sets the anchor ofthe first SISCAN operation to the anchor location of the second SISCANoperation. In order to accommodate this shift in the anchor location ofthe first SISCAN, it's the anchor offset of the first SISCAN is set to(first SISCAN anchor offset)+(second SISCAN anchor offset). This way,the anchor/offset-based partial maintenance of SISCAN operation orderwithin the index, as discussed above, now includes ordering informationfor the first SISCAN operation and the second SISCAN operation. In otherwords, the first SISCAN and the second SISCAN are now in the sameanchor-group.

SISCAN Operation Speed Control

Although a new SISCAN operation may be started in alignment with otherSISCAN operations, SISCAN operations may start drifting apart over time.This is caused, for example, by different index scan predicates and thedisk access interference. One embodiment of the present inventionadjusts the speed of SISCAN operations to reduce SISCAN operation dataaccess drift within the index over time and improve buffer data sharingamong concurrently executing SISCAN operations.

One embodiment of the present invention groups concurrently executingSISCAN operations together based on similar speeds. The SISCAN operationin the front of a group (in scan direction through the index) isdesignated as the “leader” and the SISCAN operation in the back of thegroup, based on accessing index entries in the scan direction throughthe index, is designated as the “trailer” of the group. In order toreduce drift, one embodiment of the present invention periodicallydetermines if the distance between the currently accessed index entriesof leader and trailer becomes larger than some threshold. If it does,one embodiment of the present invention inserts wait operations into theexecution of the leader to allow the trailer (and the rest of the SISCANoperations within the group) to catch up. The wait duration used by oneembodiment of the present invention is determined by the measured speedsof the SISCAN operations in the group and the distance between leaderand trailer.

An example of determining leaders and trailers in a scenario with thepartial ordering information of SISCAN operations, as described above,is able to be based on the groups illustrated by the index entrydistances 300 of FIG. 3 in a system that has, for example, a buffer sizeof 50 pages. As shown for the index entry distances 300 in this example,the partial order between the concurrently executing SISCAN operationsof this example is AØB, BØC, CØD, and EØF. The distances between SISCANoperations, within the index, are d(A,B)=40, d(B,C)=10, d(C,D)=15, andd(E,F)=20.

The processing of one embodiment of the present invention initiallysorts the pairs of SISCAN operations by their distances between oneanother and then adds them in increasing order to form larger scangroups until the sum of the extents of all scan groups reaches thebuffer size. Here, we first add (B,C), then (C,D), resulting in thegroup (B,C,D), and finally we add (E,F) which does not merge with theother groups since no previously accessed index entries of these SISCANoperations are in common with the other SISCAN operations. The finalresult are the groups (A) with extent 0, (B,C,D) with extent 25, and(E,F) with extent 20 and an overall extent of 45 (which is smaller thanthe bufferpool size). For each of these groups we have a leader (thelargest by location) and a trailer (the smallest by location). A isleader and trailer of the first group, B is trailer and D is leader ofthe second group, and E is trailer and F is leader of the third group.Now, if for example the distance between D and B becomes large, D isdelayed until the distance falls again below some threshold (andsimilarly for E and F). This way, the index entries accessed by themultiple SISCAN operations are kept close together so as to increase thedata that each SISCAN operation accesses that is already stored in thebuffer cache.

Slowing down a SISCAN operation, as is performed by one embodiment ofthe present invention improves the overall query response time eventhough such an action may seem counter-intuitive at first. If the leaderwas not slowed down in the above scenario, the distance between theleader and other SISCAN operations in the group would keep increasinguntil the distance is so large that data pages stored in the cachebuffer can no longer be reused between them. Once that happens, everypage that the leader has read will be re-read by the other SISCANoperations in the group—the I/O cost has therefore doubled. Thisadditional I/O in return also affects the leader itself negatively sinceits I/O requests get delayed more due to a busier disk.

Adaptive Buffer Page Release Prioritization

As discussed above, each SISCAN operation of one embodiment of thepresent invention releases processed pages with a variable prioritydetermined by the ISM process rather than with a fixed priority. The ISMprocess of one embodiment assigns a high priority to released pages inthe buffer that are expected to be needed soon by members of the group.The ISM process of one embodiment also assigns a low priority toreleased pages that are not expected to be needed soon. One embodimentof the present invention uses the leader-trailer status (as discussed inthe previous section) as a basis for the priority to assign to releasedpages. Pages that the leader SISCAN operation has finished processingare assigned a high priority because other SISCAN operations that willneed to process the same page are following. Pages that the trailerSISCAN operation has finished processing are assigned a low prioritybecause there often a larger gap until the next following SISCANoperation that requires that page and so the page would be discardedanyway at some point in time before the following SISCAN operation isready to read it.

Automated Processor

FIG. 4 is a block diagram of a computer system 400 useful forimplementing an embodiment of the present invention. The computer systemincludes one or more processors, such as processor 406, that is able tobe programmed to execute machine executable programs. The processor 406is connected to a communication bus 402 (e.g., a computer backplaneinterface bus, cross-over bar, or data network). Various softwareembodiments are able to be realized through the use of the computersystem 400. After reading this description, it will become apparent to aperson of ordinary skill in the relevant art(s) how to implement theinvention using other computer systems and/or computer architectures.

The computer system 400 also includes a main memory 404 that is used tostore machine executable programs that are to be executed by processor404 and to store data used by or produced by processor 404. Main memory404 is able to include random access memory (RAM) to supportreprogramming and flexible data storage.

Main memory 404 of one embodiment includes a buffer 466 that is used totemporarily store data for access by the processor 406. Main memory 404further includes a program memory 464 that includes, for example,executable programs that implement the methods described herein. Theprogram memory 464 includes, an indexed data scanner 442 that is adaptedto performing a first scan of stored data by sequentially scanningthrough an index data structure indexing the stored data and accessingthe stored data in a sequence defined by the index structure, where eachentry of the index structure indicates a respective record in the storeddata. The indexed data scanner also is adapted to maintaining, over aduration of the first scan, a first scan current scan location withinthe index data structure, the first scan current scan locationindicating a currently accessed record within the stored data structurefor the first scan. The data scanner of one embodiment is furtheradapted to continuing the second scan, subsequent to the starting thesecond scan and after the second scan reaches the second end index, atthe second start index.

The program memory 464 also includes a scan manager that is adapted toaccepting a request for a second scan of the stored data where thesecond scan specifies a second start index and a second end index withinthe index data structure. The scan manager further is adapted todetermining, during the performing the first scan, a starting locationindex within the index data structure for the second scan where thestaring location index is sufficiently near the first scan current indexto cause a respective record entry indicated by the starting locationindex to be stored within a buffer due to the performing the first scan.The scan manager also is adapted to starting the second scan at thestarting location and proceeding to the second end index. The scanmanager of one embodiment is further adapted to selecting, from amongthe plurality of indexed data scans, the first scan based upon anoverlap between of index ranges for scans within the plurality ofindexed data scans and the second scan.

The program memory 464 further includes a data output module that isadapted to providing results of the first scan and the second scan.

The program memory 464 further includes a data buffer manager 446 thatis adapted to storing a subset of the stored data that is less than allof the stored data in the buffer while performing the first scan,releasing, during the first scan, previously processed data that wasstored in the buffer and that has been processed by the first scan, toindicate that the previously processed data is able to be overwritten,marking, in response to the releasing, the previously processed data asdata to be retained in the buffer until after other released data isoverwritten, wherein the other released data is not marked as data to beretained in the buffer until after other released data is overwritten,and overwriting, in response to the marking, the other data prior tooverwriting the previously processed data.

One computer system 400 includes a display interface 408 that forwardsgraphics, text, and other data from the communication bus 402 (or from aframe buffer not shown) for display on the display unit 410. Thecomputer system also includes a secondary memory 412. The secondarymemory 412 may include, for example, a hard disk drive 414 and/or aremovable storage drive 416, representing a floppy disk drive, amagnetic tape drive, an optical disk drive, etc. A removable storagedrive 416 reads and writes to a removable storage unit 418, such as afloppy disk, magnetic tape, optical disk, etc., that stores computersoftware and/or data.

In alternative embodiments, the secondary memory 412 may include othersimilar mechanisms for allowing computer programs or other instructionsto be loaded into the computer system. Such mechanisms may include, forexample, a removable storage unit 422 adapted to exchange data throughan interface 420. Examples of such mechanisms include a programcartridge and cartridge interface (such as that found in video gamedevices), a removable memory chip (such as an EPROM, or PROM) andassociated socket, and other removable storage units 422 and interfaces420 which allow software and data to be transferred from the removablestorage unit 422 to the computer system.

The computer system 400 is also able to include a communicationsinterface 424. Communications interface 424 acts as both an input and anoutput to allow software and data to be transferred between the computersystem and external devices. Examples of a communications interface 424include a modem, a network interface (such as an Ethernet card), acommunications port, a PCMCIA slot and card, etc. Software and datatransferred via communications interface 424 are in the form of signalswhich may be, for example, electronic, electromagnetic, optical, orother signals capable of being received by communications interface 424.These signals are provided to communications interface 424 via acommunications path (i.e., channel) 426. This channel 426 carriessignals and may be implemented using wire or cable, fiber optics, aphone line, a cellular phone link, an RF link, and/or othercommunications channels.

In this document, the terms “computer program medium,” “computer usablemedium,” and “computer readable medium” are used to generally refer tomedia such as main memory 404 and secondary memory 412, removablestorage drive 416, a hard disk installed in hard disk drive 414, andsignals. These computer program products are means for providingsoftware to the computer system. The computer readable medium allows thecomputer system to read data, instructions, messages or message packets,and other computer readable information from the computer readablemedium. The computer readable medium, for example, may includenon-volatile memory, such as Floppy, ROM, Flash memory, Disk drivememory, CD-ROM, and other permanent storage. It is useful, for example,for transporting information, such as data and computer instructions,between computer systems. Furthermore, the computer readable medium maycomprise computer readable information in a transitory state medium suchas a network link and/or a network interface, including a wired networkor a wireless network, that allow a computer to read such computerreadable information.

Computer programs (also called computer control logic) are stored inmain memory 404 and/or secondary memory 412. Computer programs may alsobe received via communications interface 424. Such computer programs,when executed, enable the computer system to perform the features of thepresent invention as discussed herein. In particular, the computerprograms, when executed, enable the processor 406 to perform thefeatures of the computer system. Accordingly, such computer programsrepresent controllers of the computer system.

Alternative Embodiments

In this document, the terms “computer program medium,” “computer usablemedium,” and “computer readable medium” are used to generally refer tomedia such as main memory 404 and secondary memory 412, removablestorage drive 416, a hard disk installed in hard disk drive 414, andsignals. These computer program products are means for providingsoftware to the computer system. The computer readable medium allows thecomputer system to read data, instructions, messages or message packets,and other computer readable information from the computer readablemedium. The computer readable medium, for example, may includenon-volatile memory, such as Floppy, ROM, Flash memory, Disk drivememory, CD-ROM, and other permanent storage. It is useful, for example,for transporting information, such as data and computer instructions,between computer systems. Furthermore, the computer readable medium maycomprise computer readable information in a transitory state medium suchas a network link and/or a network interface, including a wired networkor a wireless network, that allow a computer to read such computerreadable information.

Computer programs (also called computer control logic) are stored inmain memory 404 and/or secondary memory 412. Computer programs may alsobe received via communications interface 424. Such computer programs,when executed, enable the computer system to perform the features of thepresent invention as discussed herein. In particular, the computerprograms, when executed, enable the processor 406 to perform thefeatures of the computer system. Accordingly, such computer programsrepresent controllers of the computer system.

As has now been described, embodiments of the present inventionfacilitate the maintenance of script libraries by presenting aninventive methodology of extracting common sub-procedures from anexisting script library and employing the common sub-procedures in asemi-automated process for updating the script library when theapplication being tested undergoes changes to its GUI structure.

Although specific embodiments of the invention have been disclosed,those having ordinary skill in the art will understand that changes canbe made to the specific embodiments without departing from the spiritand scope of the invention. The scope of the invention is not to berestricted, therefore, to the specific embodiments. Furthermore, it isintended that the appended claims cover any and all such applications,modifications, and embodiments within the scope of the presentinvention.

1. A method for performing concurrent scans of stored data based upon anindex data structure for the stored data, the method comprising:performing a first scan of stored data, the first scan sequentiallyscanning through an index data structure indexing the stored data andretrieving, into a buffer, records contained within the stored data in asequence defined by the index structure, each entry of the indexstructure indicating a respective record in the stored data;maintaining, over a duration of the first scan, a first scan currentscan location within the index data structure, the first scan currentscan location indicating a currently accessed record within the storeddata structure for the first scan; accepting a request for a second scanof the stored data, the second scan specifying a second start key and asecond end key within the index data structure; estimating, whileperforming the first scan, a sharing potential between the first scanand the second scan, the sharing potential indicating a likelihood thatexecution of the second scan accesses records contained within thebuffer due to the performing the first scan; determining, whileperforming the first scan and based on the sharing potential, a startingindex scan location within the index data structure for the second scan,the staring location index scan location of the second scan beinglocated relative to the first scan current scan location to cause thesecond scan to read records stored within the buffer due to theperforming the first scan; starting the second scan at the startingindex scan location and proceeding to the second end key; and providingresults of the first scan and the second scan.
 2. The method of claim 1,further comprising continuing the second scan, subsequent to thestarting the second scan and after the second scan reaches the secondend key, at the second start key.
 3. The method of claim 1 furthercomprising: storing a subset of the stored data that is less than all ofthe stored data in the buffer while performing the first scan;releasing, during the first scan, previously processed data that wasstored in the buffer and that has been processed by the first scan, toindicate that the previously processed data is able to be overwritten;marking, in response to the releasing and based on a scan range of thesecond scan defined by the second start key and the second end key, asubset of the previously processed data as data to retain in the bufferuntil after other previously processed data is overwritten, whereinother previously processed data is not marked as data to retain in thebuffer until after other released data is overwritten; and overwriting,in response to the marking, the other previously processed data prior tooverwriting the subset of previously processed data.
 4. The method ofclaim 1, further comprising: concurrently performing a plurality ofindexed data scans, the plurality of indexed data scans comprising thefirst scan; and selecting, from among the plurality of indexed datascans, the first scan based upon an overlap of index entry ranges forindex scans within the plurality of indexed data scans and the secondscan.
 5. The method of claim 4, further comprising: associating a firstanchor location for at least a first subset of the plurality of indexeddata scans, the first anchor location indicating a first anchor locationscan location within the index structure, the first anchor locationhaving been encountered by each of the at least the first subset of theplurality of indexed data scans, wherein the at least the first subsetof the plurality of indexed scans comprises the second scan;maintaining, externally from the index structure and for each indexedscan within the plurality of indexed scans, a respective displacementcount for each indexed scan of the at least the first subset of theplurality of indexed data scans, each respective displacement countindicating a respective number of indices processed after encounteringthe anchor location by respective indexed scans within the at least thefirst subset of the plurality of indexed scan; and determining at leastone distance between the second scan and each respective indexed datascan within the at least the subset of the plurality of indexed scans,the at least one respective distance comprising a difference between adisplacement count for the second scan and respective distances for eachrespective indexed data scan within the at least the subset, wherein theselecting is based at least in part on identifying the first data scanthat corresponds to a minimum distance value.
 6. The method of claim 5,further comprising: associating, in response to the starting, the firstanchor location with the second scan; and maintaining, externally fromthe index structure and for each indexed scan within the plurality ofindexed scans, a second scan displacement count, the second scandisplacement count indicating a number of indices processed afterencountering the anchor location by the second scan.
 7. The method ofclaim 5, further comprising: associating an additional anchor locationfor an additional subset of the plurality of indexed data scans, theadditional subset of the plurality of indexed data scans not comprisingthe at least the subset of indexed data scans, the additional anchorlocation indicating an additional anchor location within the indexstructure, the additional anchor location having been encountered byeach of the additional subset of the plurality of indexed data scans,wherein the at least the subset of the plurality of indexed scanscomprises the second scan; maintaining, externally from the indexstructure and for each indexed scan within the plurality of indexedscans, a respective additional displacement count for each indexed scanwithin the additional subset of the plurality of indexed data scans,each respective additional displacement count indicating a respectivenumber of indices processed after encountering the additional anchorlocation by respective indexed scans within the additional subset of theplurality of indexed scan; determining that one indexed scan within theat least the first subset of the plurality of indexed data scans hasencountered the additional anchor location; associating, in response todetermining that the one indexed scan has encountered the additionalanchor location, the additional anchor location with each indexed datascan within the at least the first subset of the plurality of indexeddata scans; and adjusting, in response to determining that the oneindexed scan has encountered the additional anchor location and inresponse to the associating the additional anchor location with eachindexed data scan within the at least the first subset of the pluralityof indexed data scans, the at least one respective displacement count bya distance between the first anchor location and the additional anchorlocation as determined by a displacement count for the one indexed scanwhen the one indexed scan encountered the additional anchor location. 8.An index scan processor adapted to perform concurrent scans of storeddata based upon an index data structure for the stored data, the indexscan processor comprising: an indexed data scanner, adapted to:performing a first scan of stored data, the first scan sequentiallyscanning through an index data structure indexing the stored data andaccessing the stored data in a sequence defined by the index structure,each entry of the index structure indicating a respective record in thestored data; and maintaining, over a duration of the first scan, a firstscan current scan location within the index data structure, the firstscan current scan location indicating a currently accessed record withinthe stored data structure for the first scan; a scan manager, adaptedto: accepting a request for a second scan of the stored data, the secondscan specifying a second start key and a second end key within the indexdata structure; determining, during the performing the first scan, astarting index scan location within the index data structure for thesecond scan, the staring index scan location being sufficiently near thefirst scan current index scan location to cause a respective recordentry indicated by the starting index scan location to be stored withina buffer due to the performing the first scan; starting the second scanat the starting index scan location and proceeding to the second endkey; and an output adapted to providing results of the first scan andthe second scan.
 9. The index scan processor of claim 8, wherein theindexed data scanner is further adapted to continuing the second scan,subsequent to the starting the second scan and after the second scanreaches the second end key, at the second start key.
 10. The index scanprocessor of claim 8 further comprising a data buffer manager, the databuffer manager adapted to: storing a subset of the stored data that isless than all of the stored data in the buffer while performing thefirst scan; releasing, during the first scan, previously processed datathat was stored in the buffer and that has been processed by the firstscan, to indicate that the previously processed data is able to beoverwritten; marking, in response to the releasing and based on a scanrange of the second scan defined by the second start key and the secondend key, a subset of the previously processed data as data to retain inthe buffer until after other previously processed data is overwritten,wherein other previously processed data is not marked as data to retainin the buffer until after other released data is overwritten; andoverwriting, in response to the marking, the other previously processeddata prior to overwriting the subset of previously processed data. 11.The index scan processor of claim 8: wherein the indexed data scanner isadapted to concurrently performing a plurality of indexed data scans,the plurality of indexed data scans comprising the first scan; andwherein the scan manager is further adapted to selecting, from among theplurality of indexed data scans, the first scan based upon an overlap ofindex entry ranges for scans within the plurality of indexed data scansand the second scan.
 12. The index scan processor of claim 11, whereinthe scan manager is further adapted to: associating a first anchorlocation for at least a first subset of the plurality of indexed datascans, the first anchor location indicating a first anchor locationwithin the index structure, the first anchor location having beenencountered by each of the at least the first subset of the plurality ofindexed data scans, wherein the at least the first subset of theplurality of indexed scans comprises the second scan; maintaining,externally from the index structure and for each indexed scan within theplurality of indexed scans, a respective displacement count for eachindexed scan of the at least the first subset of the plurality ofindexed data scans, each respective displacement count indicating arespective number of indices processed after encountering the anchorlocation by respective indexed scans within the at least the firstsubset of the plurality of indexed scan; and determining at least onedistance between the second scan and each respective indexed data scanwithin the at least the subset of the plurality of indexed scans, the atleast one respective distance comprising a difference between adisplacement count for the second scan and respective distances for eachrespective indexed data scan within the at least the subset, wherein theselecting is based at least in part on identifying the first data scanthat corresponds to a minimum distance value.
 13. The index data scannerof claim 12, wherein the scan manager is further adapted to:associating, in response to the starting, the first anchor location withthe second scan; and maintaining, externally from the index structureand for each indexed scan within the plurality of indexed scans, asecond scan displacement count, the second scan displacement countindicating a number of indices processed after encountering the anchorlocation by the second scan.
 14. The index data scanner of claim 12,wherein the scan manager is further adapted to: associating anadditional anchor location for an additional subset of the plurality ofindexed data scans, the additional subset of the plurality of indexeddata scans not comprising the at least the subset of indexed data scans,the additional anchor location indicating an additional anchor locationwithin the index structure, the additional anchor location having beenencountered by each of the additional subset of the plurality of indexeddata scans, wherein the at least the subset of the plurality of indexedscans comprises the second scan; maintaining, externally from the indexstructure and for each indexed scan within the plurality of indexedscans, a respective additional displacement count for each indexed scanwithin the additional subset of the plurality of indexed data scans,each respective additional displacement count indicating a respectivenumber of indices processed after encountering the additional anchorlocation by respective indexed scans within the additional subset of theplurality of indexed scan; determining that one indexed scan within theat least the first subset of the plurality of indexed data scans hasencountered the additional anchor location; associating, in response todetermining that the one indexed scan has encountered the additionalanchor location, the additional anchor location with each indexed datascan within the at least the first subset of the plurality of indexeddata scans; and adjusting, in response to determining that the oneindexed scan has encountered the additional anchor location and inresponse to the associating the additional anchor location with eachindexed data scan within the at least the first subset of the pluralityof indexed data scans, the at least one respective displacement count bya distance between the first anchor location and the additional anchorlocation as determined by a displacement count for the one indexed scanwhen the one indexed scan encountered the additional anchor location.15. A computer program product for performing concurrent scans of storeddata based upon an index data structure for the stored data, thecomputer program product comprising: a non-transitory storage mediumreadable by a processing circuit and storing instructions for executionby the processing circuit for performing a method comprising: performinga first scan of stored data, the first scan sequentially scanningthrough an index data structure indexing the stored data and accessingthe stored data in a sequence defined by the index structure, each entryof the index structure indicating a respective record in the storeddata; maintaining, over a duration of the first scan, a first scancurrent scan location within the index data structure, the first scancurrent scan location indicating a currently accessed record within thestored data structure for the first scan; accepting a request for asecond scan of the stored data, the second scan specifying a secondstart key and a second end key within the index data structure;determining, during the performing the first scan, a starting index scanlocation within the index data structure for the second scan, thestaring location index scan location being sufficiently near the firstscan current index scan location to cause a respective record entryindicated by the starting index scan location to be stored within abuffer due to the performing the first scan; starting the second scan atthe starting index scan location and proceeding to the second end key;continuing the second scan, subsequent to the starting the second scanand after the second scan reaches the second end key, at the secondstart key; and providing results of the first scan and the second scan.16. The computer program product of claim 15, the method furthercomprising: storing a subset of the stored data that is less than all ofthe stored data in the buffer while performing the first scan;releasing, during the first scan, previously processed data that wasstored in the buffer and that has been processed by the first scan, toindicate that the previously processed data is able to be overwritten,marking, in response to the releasing and based on a scan range of thesecond scan defined by the second start key and the second end key, asubset of the previously processed data as data to retain in the bufferuntil after other previously processed data is overwritten, whereinother previously processed data is not marked as data to retain in thebuffer until after other released data is overwritten; and overwriting,in response to the marking, the other previously processed data prior tooverwriting the subset of previously processed data.
 17. The computerprogram product of claim 15, the method further comprising: concurrentlyperforming a plurality of indexed data scans, the plurality of indexeddata scans comprising the first scan; and selecting, from among theplurality of indexed data scans, the first scan based upon an overlap ofindex entry ranges for index scans within the plurality of indexed datascans and the second scan.
 18. The computer program product of claim 15,the method further comprising: associating a first anchor location forat least a first subset of the plurality of indexed data scans, thefirst anchor location indicating a first anchor location scan locationwithin the index structure, the first anchor location having beenencountered by each of the at least the first subset of the plurality ofindexed data scans, wherein the at least the first subset of theplurality of indexed scans comprises the second scan; maintaining,externally from the index structure and for each indexed scan within theplurality of indexed scans, a respective displacement count for eachindexed scan of the at least the first subset of the plurality ofindexed data scans, each respective displacement count indicating arespective number of indices processed after encountering the anchorlocation by respective indexed scans within the at least the firstsubset of the plurality of indexed scan; determining at least onedistance between the second scan and each respective indexed data scanwithin the at least the subset of the plurality of indexed scans, the atleast one respective distance comprising a difference between adisplacement count for the second scan and respective distances for eachrespective indexed data scan within the at least the subset, wherein theselecting is based at least in part on identifying the first data scanthat corresponds to a minimum distance value.
 19. The computer programproduct of claim 18, the method further comprising: associating, inresponse to the starting, the first anchor location with the secondscan; and maintaining, externally from the index structure and for eachindexed scan within the plurality of indexed scans, a second scandisplacement count, the second scan displacement count indicating anumber of indices processed after encountering the anchor location bythe second scan.
 20. The computer program product of claim 18, themethod further comprising: associating an additional anchor location foran additional subset of the plurality of indexed data scans, theadditional subset of the plurality of indexed data scans not comprisingthe at least the subset of indexed data scans, the additional anchorlocation indicating an additional anchor location within the indexstructure, the additional anchor location having been encountered byeach of the additional subset of the plurality of indexed data scans,wherein the at least the subset of the plurality of indexed scanscomprises the second scan; maintaining, externally from the indexstructure and for each indexed scan within the plurality of indexedscans, a respective additional displacement count for each indexed scanwithin the additional subset of the plurality of indexed data scans,each respective additional displacement count indicating a respectivenumber of indices processed after encountering the additional anchorlocation by respective indexed scans within the additional subset of theplurality of indexed scan; determining that one indexed scan within theat least the first subset of the plurality of indexed data scans hasencountered the additional anchor location; associating, in response todetermining that the one indexed scan has encountered the additionalanchor location, the additional anchor location with each indexed datascan within the at least the first subset of the plurality of indexeddata scans; and adjusting, in response to determining that the oneindexed scan has encountered the additional anchor location and inresponse to the associating the additional anchor location with eachindexed data scan within the at least the first subset of the pluralityof indexed data scans, the at least one respective displacement count bya distance between the first anchor location and the additional anchorlocation as determined by a displacement count for the one indexed scanwhen the one indexed scan encountered the additional anchor location.